@color: #d6a196;

// 加载页样式
.loading-page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #6f5042;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;

    .loading-title {
        color: #F2D1C2;
        font-size: 48px;
        margin-bottom: 40px;
        letter-spacing: 4px;
    }

    .loading-container {
        display: flex;
        align-items: center;
        gap: 15px;

        .loading-bar {
            width: 300px;
            height: 20px;
            background-color: rgba(242, 209, 194, 0.3);
            border-radius: 10px;
            overflow: hidden;
            position: relative;

            .loading-progress {
                width: 0;
                height: 100%;
                background-color: #F2D1C2;
                border-radius: 10px;
                transition: width 0.3s ease;
            }
        }

        .loading-percentage {
            min-width: 48px;
            color: #F2D1C2;
            font-size: 18px;
            transition: opacity 0.3s ease;
        }
    }

    .start-btn {
        margin-top: 30px;
        padding: 12px 40px;
        font-size: 20px;
        color: #5B3F32;
        background-color: #F2D1C2;
        border: none;
        border-radius: 8px;
        cursor: pointer;
        transition: all 0.3s ease;
        display: none;

        &:hover {
            background-color: #e5c4b5;
            transform: scale(1.05);
        }
    }
}

.flex() {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
}

.bg() {
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

// 响应式断点
@desktop: ~"only screen and (min-width: 1024px)";
@tablet: ~"only screen and (min-width: 768px) and (max-width: 1023px)";
@mobile: ~"only screen and (max-width: 767px)";

html {
    background-color: @color;
    user-select: none;
    font-size: 16px;
}

body {
    padding-bottom: env(safe-area-inset-bottom);
    width: 100vw;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

.bg-img {
    width: 100vw;
    height: 100vh;
    background-image: url(../imgs/logo.webp);
    background-repeat: space;
    background-size: clamp(60px, 8vw, 100px) auto;
    opacity: 0.3;
    position: absolute;
    left: 0;
    top: 0;
}

.date {
    width: auto;
    height: min(10vh, 60px);
    .flex();
    justify-content: center;
    font-size: clamp(18px, 2.5vw, 35px);
    position: absolute;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
    color: #5B3F32;
    background-color: #F2D1C2;
    border-radius: min(7px, 1vw);
    margin-top: 5px;
    padding: 0 2%;

    .time {
        font-size: clamp(14px, 2vw, 25px);
    }
}

.game-container {
    width: min(900px, 80%);
    height: 80vh;
    position: absolute;
    top: 15%;
    left: 50%;
    transform: translateX(-50%);

    @media @mobile {
        width: 95%;
        height: 75vh;
    }
}

.cards-box {
    width: 95%;
    height: 70%;
    position: relative;
}

.card {
    width: clamp(60px, 8vw, 74px);
    height: clamp(62px, 8.2vw, 77px);
    border-radius: min(8px, 1vw);
    background-color: #e5998a;
    .flex();
    justify-content: space-around;
    box-shadow: 3px -3px 0 #646464;
    cursor: pointer;
    position: absolute;
    top: 10px;
    transition: transform 0.2s;
    transform-style: preserve-3d;
    z-index: 1;

    .mask {
        width: 100%;
        height: 100%;
        background-color: #00000035;
        position: absolute;
        top: 0;
        left: 0;
        z-index: 1;
        border-radius: inherit;
    }

    .img {
        width: 90%;
        height: 90%;
        border-radius: inherit;
        .bg();
        background-size: cover;
    }

    @media @mobile {
        width: 55px;
        height: 57px;
    }
}

.stored-card {
    width: 95%;
    height: 25%;
    margin-top: min(3%, 20px);
    background-color: #edc884;
    border-radius: min(8px, 1vw);
    position: relative;

    i {
        display: inline-block;
        width: min(9px, 1.2vw);
        height: min(15px, 2vw);
        background-image: url(../imgs/mark.webp);
        .bg();
        position: absolute;
        bottom: -3px;
    }

    .container {
        height: 100%;
        padding: min(5px, 0.7vw) min(5px, 0.7vw) min(8px, 1vw);
        box-sizing: border-box;
        display: grid;
        grid-template-columns: repeat(7, 1fr);
        gap: min(5px, 0.7vw);

        .item {
            height: 94%;
            background-color: #ffffff3e;
            border-radius: inherit;
            position: relative;
            border-radius: 8px;

            i {
                right: -6px;
                bottom: -20px;
            }
        }
    }
}

.btn-module {
    width: clamp(120px, 20%, 200px);
    height: 80%;
    position: absolute;
    right: 5%;
    top: 0;

    @media @mobile {
        width: 100px;
        right: 2%;
    }
}

.opt {
    position: absolute;
    right: 0;
    cursor: pointer;
    width: 100%;
    height: min(6%, 40px);
    font-size: clamp(12px, 1.2vw, 16px);
    color: #5B3F32;
    background-color: #F2D1C2;
    border-radius: min(8px, 1vw);
    display: flex;
    align-items: center;
    justify-content: space-around;
    touch-action: manipulation;

    @media @mobile {
        font-size: 12px;
        height: 32px;
    }
}

.opt:not(:first-of-type):hover {
    color: #F2C8BE;
    background-color: #5B3F32;
}

.game-levels {
    top: 18%;
    pointer-events: none;
}

.leftover {
    top: 26%;
    pointer-events: none;
}

.audio-switch {
    top: 34%;
    justify-content: center;
}

.change-bgaudio {
    top: 42%;
}

.reorder{
    top:50%;
    
    &.disabled {
        opacity: 0.6 !important;
        cursor: not-allowed !important;
        pointer-events: none !important;
        background-color: #D4B5A6 !important;
        color: #8B6F5E !important;
    }
}

.regame {
    top: 58%;
}






// 挑战结果（成功/失败）
.challenge-results {
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
    background-color: #00000034;
    .flex();
    justify-content: space-around;
    position: absolute;
    left: 0;
    top: 0;
    z-index: 100;
}

.popup {
    width: 30%;
    height: 50%;
    color: #5B3F32;
    background-color: #F2D1C2;
    position: relative;
    border-radius: 8px;

    .icon {
        width: 45%;
        height: 45%;
        position: absolute;
        top: 10%;
        left: 50%;
        transform: translateX(-50%) rotate(-30deg);
        white-space: nowrap;
        .bg();
    }

    button {
        width: 30%;
        height: 16%;
        position: absolute;
        bottom: 20%;
        border: none;
        cursor: pointer;
        border-radius: 8px;
        background-color: #ffa726;
        color: #fff;

        &:nth-of-type(1) {
            left: 10%;
        }

        &:nth-of-type(2) {
            right: 10%;
        }
    }
}

.success {
    transform: translateY(-100%);
    transition: all 0.5s ease;

    .icon {
        background-image: url(../imgs/success.webp);
        position: relative;
        z-index: 1;
    }
}

.fail {
    transform: translateY(-100%);
    transition: all 0.5s ease;

    .icon {
        background-image: url(../imgs/fail.webp);
    }

    .again {
        width: 40%;
        font-size: 18px;
        left: 50% !important;
        transform: translateX(-50%);
    }
}

.last-level {
    transform: translateY(-100%);
    transition: all 0.5s ease;
    position: relative;

    .last {
        display: flex;
        flex-direction: column;
        align-items: center;
        position: absolute;
        top: 20%;
        left: 50%;
        transform: translateX(-50%);

        span:nth-child(1) {
            font-size: 50px;
            margin-bottom: 5%;
        }
    }

    .again {
        width: 40%;
        font-size: 18px;
        left: 50% !important;
        transform: translateX(-50%);
    }
}

@keyframes eliminate {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }

    100% {
        transform: scale(0);
        opacity: 0;
    }
}

.remove-animation {
    animation: eliminate 0.5s forwards;
}